﻿// *----------------------------------------------------------------
// Copyright (C) 2017 通通优品
// 版权所有。
// 
// 类名：NamedTypeFactory.cs
// 功能描述：TongTongMall
// 
// Create User：jym 2017/02/09
// 
// Edit User：UserName,EditTime
// Describe：Describe
// ----------------------------------------------------------------*/
using Castle.Facilities.TypedFactory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace TongTongMall.Dependecy.Factory
{
    public class NamedTypeFactory :
            DefaultTypedFactoryComponentSelector
    {
        protected override string GetComponentName(MethodInfo method, object[] arguments)
        {
            string componentName = null;
            if (arguments != null && arguments.Length > 0)
            {
                componentName = arguments[0] as string;
            }

            if (string.IsNullOrEmpty(componentName))
                componentName = base.GetComponentName(method, arguments);

            return componentName;
        }
    }
}
